<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<jsp:include page="../common/nav.jsp"></jsp:include>
<div class="wrapper wrapper-content animated fadeInRight">
	<jsp:include page="search.jsp"></jsp:include>
	<div class="row">
		<div class="col-lg-12">
			<div class="ibox ">
		        <div class="ibox-title">
		            <h4>询价单列表</h4>
		            <div class="ibox-tools">
		                <button id="addButton" class="btn btn-success btn-sm" type="button" onclick="addData()"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">发起询价单</span></button>
		                <button id="searchButton" class="btn btn-default btn-sm btn-notcontrol" type="button"><i class="fa fa-search"></i>&nbsp;&nbsp;展开查询</button>
		            </div>
		        </div>
				<div class="ibox-content border-bottom" style="padding-bottom: 0;">
					<div class="table-responsive">
						<table class="table table-striped table-hover table-bordered border-top">
							<thead>
								<tr>
									<th width="5%">序号</th>
									<th>编号</th>
									<th>标题</th>
									<th>采购方式</th>
									<th>状态</th>
									<th width="10%">操作</th>
								</tr>
							</thead>
							<tbody>
							    <c:forEach items="${requestScope.list}" var="data" varStatus="index">
									<tr>
										<td>${index.count}</td>
										<td>${data.code}</td>
										<td>${data.title}</td>
										<td>${requestScope.procurementTypeMap[data.procurementType]}</td>
										<c:if test="${fn:length(data.status) > 1}">
											<td>${data.status}</td>
										</c:if>
										<c:if test="${fn:length(data.status) == 1}">
											<td>${requestScope.statusMap[data.status]}</td>
										</c:if>
										<td>
											<div class="btn-group">
												<c:if test="${data.status eq '比价中'}">
													<c:if test="${data.inquiryType eq '1'}">
														<button class="btn-white btn btn-xs btn-notcontrol" onclick="priceParity('${data.id}')"><i class="fa fa-eye"></i>&nbsp;比价</button>&nbsp;
													</c:if>
												</c:if>
												<c:if test="${data.status eq '1' or data.status eq '3'}">
													<button class="btn-white btn btn-xs btn-notcontrol" onclick="priceParityResult('${data.id}')"><i class="fa fa-eye"></i>&nbsp;比价结果</button>&nbsp;
												</c:if>
												<button class="btn-white btn btn-xs btn-notcontrol" onclick="showData('${data.id}')"><i class="fa fa-eye"></i>&nbsp;查看</button>&nbsp;
											</div>
										</td>
									</tr>
								</c:forEach>
							</tbody>
							<tfoot>
							<jsp:include page="../common/pages.jsp"></jsp:include>
							</tfoot>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="js/listPage.js"></script>
<script>
	// 添加
	function addData() {
		window.location.href="web/inquiryList/get";
	}

	// 比价
	function priceParity(id) {
		window.location.href="web/inquiryList/toPriceParity?id=" + id;
	}

	// 比价结果
	function priceParityResult(id) {
		window.location.href="web/inquiryList/priceParityResult?id=" + id;
	}

	// 查看
	function showData(id) {
		window.location.href="web/inquiryList/detail?id=" + id;
	}
</script>